import { S } from '../../s';
import { IPSApplication } from '../ipsapplication';
import { IPSAppMsgTempl } from '../msg/ipsapp-msg-templ';
import { IPSAppViewMsg } from './ipsapp-view-msg';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppViewMsgImpl
  extends PSModelObjectImpl
  implements IPSAppViewMsg
{
  get codeName(): string {
    return this.M.codeName;
  }

  protected contentpslanguageres: IPSLanguageRes;
  getContentPSLanguageRes(): IPSLanguageRes | null {
    return (
      this.contentpslanguageres ||
      (this.contentpslanguageres = this.fillObjectModel(
        S._276,
        this.M.getContentPSLanguageRes,
        S._2dc,
      ) as IPSLanguageRes)
    );
  }

  get dynamicMode(): 0 | 1 {
    return this.M.dynamicMode != null ? this.M.dynamicMode : 0;
  }

  get message(): string {
    return this.M.message;
  }

  get messageType(): 'INFO' | 'WARN' | 'ERROR' | 'CUSTOM' {
    return this.M.messageType;
  }

  protected psappmsgtempl: IPSAppMsgTempl;
  getPSAppMsgTempl(): IPSAppMsgTempl | null {
    if (this.psappmsgtempl != null) return this.psappmsgtempl;
    const value = this.M.getPSAppMsgTempl;
    if (value == null) {
      return;
    }
    const ipsapplication = this.getParentPSModelObject(
      S._26e,
    ) as IPSApplication;
    if (ipsapplication != null) {
      this.psappmsgtempl = ipsapplication.findPSAppMsgTempl(value);
    }
    return this.psappmsgtempl;
  }

  get position(): 'TOP' | 'BOTTOM' | 'BODY' | 'POPUP' | 'CUSTOM' {
    return this.M.position;
  }

  get removeMode(): 0 | 1 | 2 {
    return this.M.removeMode;
  }

  get title(): string {
    return this.M.title;
  }

  get titleLanResTag(): string {
    return this.M.titleLanResTag;
  }

  protected titlepslanguageres: IPSLanguageRes;
  getTitlePSLanguageRes(): IPSLanguageRes | null {
    return (
      this.titlepslanguageres ||
      (this.titlepslanguageres = this.fillObjectModel(
        S._276,
        this.M.getTitlePSLanguageRes,
        S._2b1,
      ) as IPSLanguageRes)
    );
  }

  get enableRemove(): boolean {
    return this.M.enableRemove;
  }
  get cls(): string {
    return 'PSAppViewMsgImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._86) return true;
    return super.instanceof(cls);
  }
}
